<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>短视频APP-管理系统</title>
        <meta name="keywords" content="短视频APP-管理系统">
        <meta name="description" content="">
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <meta name="apple-mobile-web-app-status-bar-style" content="black"> 
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="format-detection" content="telephone=no">
        <link rel="stylesheet" href="{$sys_url.static}layui/css/layui.css" media="all">
        <style>
            .frameContent {padding:30px 30px 0px 0px}
            .roleList {float:left;margin:5px 0px;width:33%}
            .frameBtn {text-align:center;margin:20px 0px 0px 30px;padding-top:20px;border-top:1px rgb(204,204,204) dashed}
        </style>
    </head>
    <body> 
        <div>
            <form class="layui-form frameContent">

                <input type="hidden" name="id"  value="{$item.id}" />

                <div class="layui-form-item">
                    <div class="layui-form-label">用户ID</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.id}</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">昵称</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.name}</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">头像</div>
                    <div class="layui-input-block">
                        <img src="{$item.head_url}">
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">注册方式</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.type}</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">注册渠道</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.channel}</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">VIP</div>
                    <div class="layui-input-inline">
                        <div class="layui-col-md12">
                            <input type="radio" name="is_vip" value="1" title="是" {eq name="$item.is_vip" value="1"} checked=""{/eq}><div class="layui-unselect layui-form-radio layui-form-radioed"><i class="layui-anim layui-icon layui-anim-scaleSpring"></i><div>是</div></div>
                            <input type="radio" name="is_vip" value="0" title="否" {eq name="$item.is_vip" value="0"} checked=""{/eq}><div class="layui-unselect layui-form-radio"><i class="layui-anim layui-icon"></i><div>否</div></div>
                        </div>
                    </div>
                    <div class="layui-form-mid layui-word-aux">是否VIP</div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-form-label">到期时间</div>
                    <div class="layui-input-inline">
                        <input type="text" name="expiration_time" class="layui-input" id="test5" value="{$item.expiration_time}" placeholder="yyyy-MM-dd HH:mm:ss">
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-form-label">注册时间</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.add_time}</div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-form-label">上次登录</div>
                    <div class="layui-input-block">
                        <div class="layui-form-mid layui-word-aux">{$item.last_login_time}</div>
                    </div>
                </div>

                <div class="frameBtn">
                  <button class="layui-btn" lay-submit lay-filter="submit">修改保存</button>
                </div>
            </form>
        </div>
    </body>
    <script src="{$sys_url.static}layui/layui.js" charset="utf-8"></script>
    <script>
        layui.use('layer', function(){
            var $ = layui.$ //由于layer弹层依赖jQuery，所以可以直接得到
                ,layer = layui.layer;



            $(document).on('click',".layui-btn-normal",function(){

                var id = $(this).attr("data");

                var obj = $(this);

                layer.confirm('是否确定要删除？', {icon: 3, title: '系统信息'}, function(index) {

                    $.ajax({
                        url: '{$sys_url.ctr}/deldev',
                        type: 'post',
                        data: {id:id},
                        dataType: "json",
                        beforeSend: function() {
                            //console.log(JSON.stringify(data.field));
                        },
                        success: function(data) {
                            //do something
                            if (data.code == 1) {
                                obj.parent().parent().remove();
                                parent.layer.msg('删除成功', {icon: 1});
                            } else {
                                layer.alert('抱歉，系统繁忙，请稍后再试！', {icon: 2});
                            }
                        },
                        error: function(data) {

                            layer.msg('与服务器连接失败', {icon: 2});
                        }
                    });
                    layer.close(index);
                });
                return false;
            });

        });


        layui.use(['form'], function() {
            var form = layui.form;
            var $ = layui.jquery;
            var roleArr = [];

            function del(str){
                  lay.msg(str);
            }

            //监听提交
            form.on('submit(submit)', function(data) {
                layer.confirm('是否确定修改？', {icon: 3, title: '系统信息'}, function(index) {
                    $.ajax({
                        url: '{$sys_url.ctr}/edit_ajax',
                        type: 'post',
                        data: data.field,
                        dataType: "json",
                        beforeSend: function() {
                            //console.log(JSON.stringify(data.field));
                        },
                        success: function(data) {
                            //do something
                            if (data.code == 1) {
                                var index = parent.layer.getFrameIndex(window.name);//获取当前窗口索引
                                parent.layer.msg('修改成功', {icon: 1});
                                parent.layer.close(index);
                            } else {
                                layer.alert('抱歉，系统繁忙，请稍后再试！', {icon: 2});
                            }
                        },
                        error: function(data) {
                            //do something
                            layer.msg('与服务器连接失败', {icon: 2});
                        }
                    });
                    layer.close(index);
                });
                return false;
            });
        });
        layui.use('laydate', function(){
            var laydate = layui.laydate;
            laydate.render({
                elem: '#test5'
                ,type: 'datetime'
            });

        });
    </script>

</html>